home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / System 7.0 Samples / DTS.Utilities / Utilities.r < prev    next >
Encoding:
Text File  |  1994-11-18  |  5.8 KB  |  191 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    Collection of Utilities for DTS Sample code
  6. #
  7. #    Program:    Utilities
  8. #    File:        Utilities.r    -    Rez Source
  9. #
  10. #    Copyright © 1988-1990 Apple Computer, Inc.
  11. #    All rights reserved.
  12. #
  13. ------------------------------------------------------------------------------*/
  14.  
  15. #include "UtilitiesCommon.h"
  16.  
  17. /* These #defines are used to set enable/disable flags of a menu */
  18.  
  19. #define AllItems    0b1111111111111111111111111111111    /* 31 flags */
  20. #define NoItems        0b0000000000000000000000000000000
  21. #define MenuItem1    0b0000000000000000000000000000001
  22. #define MenuItem2    0b0000000000000000000000000000010
  23. #define MenuItem3    0b0000000000000000000000000000100
  24. #define MenuItem4    0b0000000000000000000000000001000
  25. #define MenuItem5    0b0000000000000000000000000010000
  26. #define MenuItem6    0b0000000000000000000000000100000
  27. #define MenuItem7    0b0000000000000000000000001000000
  28. #define MenuItem8    0b0000000000000000000000010000000
  29. #define MenuItem9    0b0000000000000000000000100000000
  30. #define MenuItem10    0b0000000000000000000001000000000
  31. #define MenuItem11    0b0000000000000000000010000000000
  32. #define MenuItem12    0b0000000000000000000100000000000
  33. #define MenuItem13    0b0000000000000000001000000000000
  34. #define MenuItem14    0b0000000000000000010000000000000
  35. #define MenuItem15    0b0000000000000000100000000000000
  36. #define MenuItem16    0b0000000000000001000000000000000
  37. #define MenuItem17    0b0000000000000010000000000000000
  38. #define MenuItem18    0b0000000000000100000000000000000
  39. #define MenuItem19    0b0000000000001000000000000000000
  40. #define MenuItem20    0b0000000000010000000000000000000
  41. #define MenuItem21    0b0000000000100000000000000000000
  42. #define MenuItem22    0b0000000001000000000000000000000
  43. #define MenuItem23    0b0000000010000000000000000000000
  44. #define MenuItem24    0b0000000100000000000000000000000
  45. #define MenuItem25    0b0000001000000000000000000000000
  46. #define MenuItem26    0b0000010000000000000000000000000
  47. #define MenuItem27    0b0000100000000000000000000000000
  48. #define MenuItem28    0b0001000000000000000000000000000
  49. #define MenuItem29    0b0010000000000000000000000000000
  50. #define MenuItem30    0b0100000000000000000000000000000
  51. #define MenuItem31    0b1000000000000000000000000000000
  52.  
  53.  
  54. // The following values are used to place the locations of items in
  55. // an alert according to the Human Interface Guidelines (HIN #10)
  56.  
  57. // These values are very customizable, and you'll probably want to change them.
  58. #define    NumTextLines        5    // number of lines of text to allow in the alert
  59. #define AlertWidth            341    // Just 'cause
  60. #define LongestButtonName    41    // width of "Cancel" in Chicago 12
  61.  
  62. // These 3 values are customizable, but you probably wouldn't change them
  63. #define LineHeight            16    // height of a single line of Chicago 12
  64. #define ButtonHeight        20    // standard button height
  65. #define ButtonWidth            (LongestButtonName + 18)
  66.  
  67. // The next 6 values are very fixed, and don't depend on anything
  68. #define MarginA                10    // white space between most elements
  69. #define MarginB                20    // white space to left and right of icon
  70.  
  71. #define IconTop                (MarginA)
  72. #define IconLeft            (MarginB)
  73. #define IconBottom            (IconTop + 32)
  74. #define IconRight            (IconLeft + 32)
  75.  
  76. // The remaining values here are very flexible, mostly relying on the
  77. // settings of NumTextLines, LineHeight, AlertWidth, and LongestButtonName
  78. #define TextTop                (MarginA)
  79. #define TextLeft            (IconRight + MarginB)
  80. #define TextBottom            (TextTop + (NumTextLines * LineHeight))
  81. #define TextRight            (AlertWidth - MarginA)
  82.  
  83. #define ButtonTop            (TextBottom + MarginA)
  84. #define ButtonBottom        (ButtonTop + ButtonHeight)
  85. #define ActionButtonRight    (AlertWidth - MarginA)
  86. #define ActionButtonLeft    (ActionButtonRight - ButtonWidth)
  87. #define CancelButtonRight    (ActionButtonLeft - MarginA)
  88. #define CancelButtonLeft    (CancelButtonRight - ButtonWidth)
  89.  
  90. #define AlertHeight            (ButtonBottom + MarginA)
  91.  
  92.  
  93. resource 'STR#' (rUtilStrings, purgeable) {
  94.     {
  95.     /* [1] */    "An error occurred";
  96.     /* [2] */    "I couldn't create the menubar because I couldn't find the specified MBAR resource";
  97.     };
  98. };
  99.  
  100.  
  101.  
  102. /* this ALRT and DITL are used in our error alerts */
  103.  
  104. resource 'ALRT' (rUtilErrorAlert, purgeable) {
  105.     {0, 0, AlertHeight, AlertWidth},
  106.     rUtilErrorAlert,
  107.     {
  108.         OK, visible, silent,
  109.         OK, visible, silent,
  110.         OK, visible, silent,
  111.         OK, visible, silent
  112.     }
  113. };
  114.  
  115. resource 'DITL' (rUtilErrorAlert, purgeable) {
  116.     {
  117.         { ButtonTop, ActionButtonLeft, ButtonBottom, ActionButtonRight },
  118.         Button { enabled, "OK" },
  119.  
  120.         { TextTop, TextLeft, TextBottom, TextRight },
  121.         StaticText { disabled, "^0." },
  122.         
  123.         { IconTop, IconLeft, IconBottom, IconRight },
  124.         Icon { enabled, 0 };            // Stop Icon
  125.     };
  126. };
  127.  
  128.  
  129. /* this ALRT and DITL are used in our message error alerts */
  130.  
  131. resource 'ALRT' (rUtilErrorMessageAlert, purgeable) {
  132.     {0, 0, AlertHeight, AlertWidth},
  133.     rUtilErrorMessageAlert,
  134.     {
  135.         OK, visible, silent,
  136.         OK, visible, silent,
  137.         OK, visible, silent,
  138.         OK, visible, silent
  139.     }
  140. };
  141.  
  142. resource 'DITL' (rUtilErrorMessageAlert, purgeable) {
  143.     {
  144.         { ButtonTop, ActionButtonLeft, ButtonBottom, ActionButtonRight },
  145.         Button { enabled, "OK" },
  146.  
  147.         { TextTop, TextLeft, TextBottom, TextRight },
  148.         StaticText { disabled, "^0.   The error number reported was: ^1." },
  149.         
  150.         { IconTop, IconLeft, IconBottom, IconRight },
  151.         Icon { enabled, 0 };            // Stop Icon
  152.     };
  153. };
  154.  
  155.  
  156. /* this ALRT and DITL are used as an About screen */
  157.  
  158. resource 'ALRT' (rStdAboutAlert, purgeable) {
  159.     {0, 0, 136, 290},
  160.     rStdAboutAlert,
  161.     {
  162.         OK, visible, silent,
  163.         OK, visible, silent,
  164.         OK, visible, silent,
  165.         OK, visible, silent
  166.     }
  167. };
  168.  
  169. resource 'DITL' (rStdAboutAlert, purgeable) {
  170.     {
  171.         { 104, 180, 124, 260 },
  172.         Button { enabled, "OK" },
  173.  
  174.         { 8, 8, 24, 262 },
  175.         StaticText { disabled, "^0" },
  176.  
  177.         { 32, 8, 48, 65 },
  178.         StaticText { disabled, "Version:" },
  179.  
  180.         { 32, 65, 64, 270 },
  181.         StaticText { disabled, "^1" },
  182.  
  183.         { 72, 8, 88, 136 },
  184.         StaticText { disabled, "Brought to you by:" },
  185.  
  186.         { 96, 24, 128, 167 },
  187.         StaticText { disabled, "Apple Developer  Technical Support" },
  188.     }
  189. };
  190.  
  191.